import { toSuccess } from "@sker/core";
import { z } from "zod";
import { useData, useWeapp } from "@sker/runtime";
const input2 = z.object({
    page: z.string(),
    scene: z.string(),
    env_version: z.optional(z.enum(["release", "trial", "develop"])),
})
export default async () => {
    const body = input2.parse(useData())
    const weapp = await useWeapp()
    const result = await weapp.getUnlimitedQRCode({
        page: body.page,
        scene: `${body.scene}`,
        env_version: body.env_version || 'release',
    });
    if (result.errcode) {
        throw new Error(result.errmsg)
    }
    const base64 = Buffer.from(result).toString('base64')
    return toSuccess(base64)
}